package com.xuecheng.base.exception;

/**
 * 本项目自定义异常类型
 */
public class XueChengPlusException extends RuntimeException{

    private String errMessage;

    private int errCode = 0;

    public XueChengPlusException() {
    }

    public XueChengPlusException(String errMessage) {
        this.errMessage = errMessage;
    }

    public XueChengPlusException(String errMessage,int errCode) {
        this.errMessage = errMessage;
        this.errCode = errCode;
    }
    public String getErrMessage() {
        return errMessage;
    }
    public int getErrCode(){
        return errCode;
    }
    public void setErrCode(int errCode){
        this.errCode = errCode;
    }
    public static void cast(String errMessage) {
        throw new XueChengPlusException(errMessage);
    }
    public static void cast(String errMessage,int errCode) {
        throw new XueChengPlusException(errMessage,errCode);
    }
    public static void cast(CommonError commonError) {
        throw new XueChengPlusException(commonError.getErrMessage());
    }


}
